package com.ruoyi.user.controller;

import com.ruoyi.common.core.domain.IdVo;
import com.ruoyi.common.core.domain.PermVo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.RoleVo;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.user.service.TbPermService;
import com.ruoyi.user.service.TbRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 咸鱼
 * @version 1.0
 * @description: TODO
 * @date 2023/1/13 11:22
 */
@RestController
@RequestMapping("/role")
public class TbRoleController {

    @Autowired
    private TbRoleService tbRoleService;

    @PostMapping("/addRole")
    public R addRole(@RequestBody RoleVo roleVo){
        return tbRoleService.addRole(roleVo);
    }

    @DeleteMapping("/deleteRoleById")
    public R deleteRoleById(@RequestBody IdVo idVo){
        return tbRoleService.deleteRoleById(idVo);
    }

    @GetMapping("/selectRole")
    public AjaxResult selectRole(){
        return tbRoleService.selectRole();
    }

    @PostMapping("/updateRole")
    public R updateRole(@RequestBody RoleVo roleVo){
        return tbRoleService.updateRole(roleVo);
    }
}
